package finance

import grails.test.*

class SessionIntegrationTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testFirstSimulation() {
		def simulation = new Simulation(name : "sim1", description : " first test").save()
		def session1 = new Session(description : "First session")
		simulation.addToSessions( session1 )
		def session2 = new Session(description : "Second session")
		simulation.addToSessions( session2 )
		assertEquals 2, Simulation.get(simulation.id).sessions.size()
	
		def foundSimulation = Simulation.get(simulation.id)	
		def descriptions = foundSimulation.sessions.collect { it.description }
		assertEquals( ['First session', 'Second session'], descriptions.sort())
    }
}
